package com.example.myys.network

import com.example.myys.data.entity.ChapterBean
import com.example.myys.data.entity.DataBean
import com.example.myys.network.mhPlugins.MhHtmlParse
import com.example.myys.network.parse.HtmlParse
import com.example.myys.network.xsPlugins.BQGParse
import com.example.myys.network.yyPlugins.YyParse

object HtmlClient {
    val parses=
        mapOf<String, HtmlParse>(
            "XsBqg" to BQGParse(),
            "Yy" to YyParse(),
            "Mh" to MhHtmlParse()
        )
    //推荐
    suspend fun getRecommend(parseName:String,createDate:String): List<DataBean>? {
       return parses.get(parseName)?.getDataRecommend(createDate)
    }

    //详情信息
    suspend fun getDataInfo(parseName: String, dataUrl: String): DataBean? {
        return parses.get(parseName)?.getDataInfo(dataUrl)
    }
    //集数列表
    suspend fun getChapterList(parseName: String,chaptersUrl:String,dataBeanId:Int):List<ChapterBean>?{
        return parses.get(parseName)?.getChapterList(chaptersUrl,dataBeanId)
    }
    //内容
    suspend fun getChapterContent(parseName: String,chapterUrl: String):String?{
        return parses.get(parseName)?.getChapterContent(chapterUrl)
    }
    //搜索
    suspend fun getSearchByKeword(parseName: String,keyWord:String):List<DataBean>?{
        return parses.get(parseName)?.getSearchByKeyword(keyWord)
    }
    //分类列表
    suspend fun getDataListByType(parseName: String,type:String):List<DataBean>?{
        return parses.get(parseName)?.getDataListByType(type)
    }
}